package org.example.pro1;

import org.example.pro1.service.StudentService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;

import java.util.List;

@Import(MysqlConfig.class)
@ComponentScan
public class ApplicationTest {
    public static void main(String[] args) {
        ApplicationContext context=new AnnotationConfigApplicationContext(ApplicationTest.class);
        StudentService studentService=context.getBean(StudentService.class);
       List<Student> students=studentService.getAllStudents();
       //输出学生信息
       for(Student student:students){
           System.out.println(student);
       }

        //添加学生信息
//        studentService.addStudent("zhangsan",18,"男");
        //16行代码: studentService = $Proxy31@3245     //代理对象  面向接口的jdk动态代理

    }
}
